﻿<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <title>首页</title>
    <link href="/CSS/bootstrap3.3.5/css/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="/CSS/font-awesome-4.3.0/css/font-awesome.css?v=4.3.0" rel="stylesheet">
    <link href="/CSS/V3/animate.css" rel="stylesheet">
    <link href="/CSS/V3/style.css?v=2.2.0" rel="stylesheet">
    <link href="/CSS/V3/BaseClassV3.css" rel="stylesheet">
    <link href="/CSS/V3/index.css" rel="stylesheet">
    <style>
        table {
            font-size: 14px;
        }

        img {
            max-width: 100%;
        }
    </style>

</head>
<body ms-controller="indexPage" style="background-color:#f5f5f5">

    <div class="wrapper-content animated fadeInRight" style="padding-top:10px">

        <div class="row">
            <div class="col-sm-8">
                <a ms-repeat-item="KJBtn" class="btn btn-info" style="margin-top:10px;margin-right:10px;margin-bottom:10px" ms-click="OpenCreateForm(item.code)" ms-if-loop="item.issel">{{item.title}}</a>

                <div class="tabs-container">
                    <ul class="nav nav-tabs">
                        <li class="active">
                            <a data-toggle="tab" href="#tab-dbrw" aria-expanded="true">任务管理</a>
                        </li>
                        <li>
                            <a data-toggle="tab" href="#tab-dsh" aria-expanded="false">待审核<span class="label label-info" ms-if="DSHData.size()>0">{{DSHData.size()}}</span></a>
                        </li>
                        <li>
                            <a data-toggle="tab" href="#tab-jsb" aria-expanded="false">记事本<span class="label label-info"></span></a>
                        </li>

                    </ul>
                    <div class="tab-content">
                        <div id="tab-dbrw" class="tab-pane active">
                            <div class="panel-body" style="min-height:400px">
                                <div class="social-feed-box" ms-repeat-el="DBDataList" style="border:0;border-bottom: 1px solid #e7eaec;">

                                    <div class="pull-right social-action dropdown" style="margin-bottom:0">
                                        <a class=" btn btn-primary btn-xs btntool " ms-if="el.ISGB"><i ms-on-click="completeDB(el,event,this)" class="iconfont icon-weigouxuan" style="font-size: 12px; margin-right: 3px;color:white"></i>关闭任务</a>
                                        <a class=" btn btn-primary btn-xs btntool" ms-attr-dataid="el.ID" ms-attr-dbnr="el.Name" ms-attr-leibie="el.LeiBie" ms-attr-txdate="el.TXTime" ms-click="ModityRCTX(el.ID)" ms-attr-txr="el.TXUser" ms-if="el.CRUser==username"><i class="fa fa-pencil"></i> 编辑 </a>
                                        <a class="btn btn-danger btn-xs btntool" style="margin-right:15px" ms-if="el.CRUser==username" ms-click="deltx(el,event)"><i class="fa fa-trash-o"></i> 删除 </a>
                                        <a class="btn btn-white btn-xs" data-toggle="collapse" ms-attr-href="'#faq'+el.ID"><i class="fa fa-angle-down"></i> </a>
                                    </div>
                                    <div class="social-avatar">
                                        <p>

                                            <label class="label label-danger" style="margin-right:10px" ms-if="ComFunJS.daysBetween(ComFunJS.getnowdate('yyyy-mm-dd'), el.CRDate.substring(0,10))<=0">已过期</label>
                                            <label ms-if="ComFunJS.daysBetween(ComFunJS.getnowdate('yyyy-mm-dd'), el.CRDate.substring(0,10))>0">{{rwzt(el.RWStatus)|html}}</label>
                                            <label class="label label-danger" style="margin-right:10px" ms-if="el.LeiBie=='重要'">{{el.LeiBie}}</label>
                                            <a class=" btn btn-primary btn-xs btntool " ms-if="($.inArray(username, el.RWCYR.split(','))>-1||$.inArray(username, el.RWFZR.split(','))>-1)&&el.CRUser!=username"><i ms-on-click="ComGRDB(el,event,this)" class="iconfont icon-weigouxuan" style="font-size: 12px; margin-right: 3px;color:white"></i>完成任务</a>
                                        </p>

                                    </div>

                                    <div style="padding:5px 15px 0 15px">
                                        <p>
                                            {{el.RWTitle|html}}
                                        </p>
                                    </div>

                                    <div class="social-body" style=" padding-top: 0px; padding-bottom: 0px; ">
                                        <p class="jnperson">
                                            <span>创建人：<span class="text-success">{{ComFunJS.convertuser(el.CRUser)}}</span></span>
                                            <span>负责人：</span><span class="text-success"><span>{{ComFunJS.convertuser(el.RWFZR)}}</span></span>
                                            <span style="padding-left:10px;" ms-if="el.RWCYR.length>0">参与人：</span>
                                            <span class="text-success"><span style="margin-right:10px" ms-repeat-user="el.RWCYR.split(',')">{{ComFunJS.convertuser(user) }}</span></span>
                                            <small class="pull-right btntool">
                                                <span class="text-danger">{{el.RWJZDate|date("yyyy年MM月dd日")}}</span>
                                                <a style="margin-right:10px;margin-left:5px;" ms-click="addDB(el)">添加提醒</a>
                                                <a ms-if="el.RWStatus=='0'" ms-click="addZRW(el.ID)"> 添加子任务 </a>
                                            </small>
                                        </p>
                                        <p>
                                            <span ms-if="el.PLList.size()>0" style="margin-right:5px;">评论数： {{el.PLList.size()+(el.RCTXStatus.length>0? el.RCTXStatus.size():0)}}个 </span>
                                            <span ms-if="el.ZRWCount>0">
                                                <span>子任务：</span><span><span>{{el.ZRWCount}}个</span></span>
                                                <a class=" btn btn-primary btn-xs" ms-if="el.ZRWCount>0" ms-click="viewZRW(el.ID)"> 查看 </a>
                                            </span>
                                        </p>
                                        <p>
                                            <label ms-if="el.FileList.length>0"> 附件：</label><span ms-repeat-files="el.FileList">
                                                <a style="margin-left:10px" target="_blank" download="filename" ms-attr-href="'/View/Common/DownLoadFile.aspx?MD5='+files.FileMD5">{{files.Name+'.'+files.FileExtendName}}</a>
                                                <a style="margin-left:5px; color:#ff6a00" ms-if="files.FileExtendName=='doc'||files.FileExtendName=='docx'||files.FileExtendName=='pdf'" ms-click="ShowFile(files.ID,event)">预览</a>
                                            </span>
                                        </p>
                                    </div>

                                    <div class="social-footer collapse" ms-attr-id="'faq'+el.ID">
                                        <div class="social-comment" ms-repeat-item="el.RCTXStatus">
                                            <span class="pull-left">
                                                <img alt="image" ms-attr-src="'/Upload/TX/'+item.rwUser+'.jpg'" onerror="javascript: this.src = '/images/TX/default.png'">
                                            </span>
                                            <div class="media-body">
                                                <span style="color: #3085DB;">
                                                    {{item.rwUserName}}
                                                </span>完成任务
                                                <br /> -
                                                <small class="text-muted">{{item.CRDate|date("MM月dd日 HH:mm")}}</small>
                                            </div>
                                        </div>


                                        <div class="social-comment" ms-repeat-item="el.PLList">
                                            <span class="pull-left">
                                                <img alt="image" ms-attr-src="'/Upload/TX/'+item.CRUser+'.jpg'" onerror="javascript: this.src = '/images/TX/default.png'">
                                            </span>
                                            <div class="media-body">
                                                <span style="color: #3085DB;">
                                                    {{item.CRUserName}}
                                                </span> {{item.MSGContent}}
                                                <br /> -
                                                <small class="text-muted">{{item.CRDate|date("MM月dd日 HH:mm")}}</small>
                                            </div>
                                        </div>

                                        <div class="social-comment">
                                            <span class="pull-left">
                                                <img alt="image" ms-attr-src="'/Upload/TX/'+username+'.jpg'" onerror="javascript: this.src = '/images/TX/default.png'">
                                            </span>
                                            <div class="media-body">
                                                <div class="input-group">
                                                    <input type="text" class="form-control plnr" placeholder="填写内容(按Ctrl+Enter直接提交)" ms-keypress="jptj(el,this,event)" />
                                                    <span class="input-group-btn">
                                                        <button type="button" class="btn btn btn-primary " ms-on-click="addPL(el,this,event)">  发表</button>
                                                    </span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div id="pageDBDiv" class="text-right"></div>
                            </div>
                        </div>
                        <div id="tab-dsh" class="tab-pane">
                            <div class="panel-body" style=" padding-left: 0;padding-right: 0;">
                                <div class="table-responsive">
                                    <table class="table table-striped  table-hover">
                                        <thead>
                                            <tr>
                                                <th>流程类型</th>
                                                <th>发起人</th>
                                                <th>发起时间</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr ms-repeat-item="DSHData">
                                                <td><a ms-click="ViewWF(item.ID,item.intProcessStanceid,item.ProName,item.lcType)" href="#">{{item.Name}}</a> </td>
                                                <td>
                                                    {{ComFunJS.convertuser(item.CRUser)}}
                                                </td>
                                                <td>{{item.CRDate|date("yyyy-MM-dd")}}</td>

                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <div id="tab-jsb" class="tab-pane">
                            <div class="panel-body" style=" padding-left: 0;padding-right: 0;">
                                <div class="table-responsive">

                                    <table class="table table-striped table-hover">
                                        <thead>
                                            <tr>
                                                <th>序号</th>
                                                <th>类型</th>
                                                <th>标题</th>
                                                <th>最后修改时间</th>
                                                <th>操作</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr ms-repeat-item="NoteDataList" class="note">
                                                <td>{{$index+1}}</td>
                                                <td>{{item.TagName}}</td>
                                                <td><a ms-click="ViewForm(item.ID)"><i class="fa fa-pencil"></i> {{item.NoteTitle}} </a></td>
                                                <td>{{item.UPDDate|date("yyyy-MM-dd HH:mm")}}</td>
                                                <td style="width:150px">
                                                    <a class=" btn btn-primary btn-xs btntool" ms-click="ViewForm(item.ID)"><i class="fa fa-pencil"></i> 编辑 </a>
                                                    <a class="btn btn-danger btn-xs btntool" ms-click="DELForm(item)" style="margin-right:15px"><i class="fa fa-trash-o"></i> 删除 </a>
                                                </td>
                                            </tr>
                                        </tbody>
                                        <tfoot>
                                            <tr>
                                                <td colspan="6"><div id="pageDiv" class="text-right"></div></td>
                                            </tr>
                                        </tfoot>
                                    </table>
                                </div>
                            </div>
                        </div>

                    </div>


                </div>
                <div class="tabs-container" style="margin-top:20px">
                    <ul class="nav nav-tabs">
                        <li class="active">
                            <a data-toggle="tab" href="#tab-cylj" aria-expanded="true">常用链接</a>
                        </li>
                        <li>
                            <a data-toggle="tab" href="#tab-kjkh" aria-expanded="false">快捷客户</a>
                        </li>
                        <li style="display:none">
                            <a data-toggle="tab" href="#tab-cywd" aria-expanded="false">常用文档</a>
                        </li>
                    </ul>
                    <div class="tab-content" style=" max-height: 400px;overflow: auto;min-height:200px">
                        <div id="tab-cylj" class="tab-pane active">
                            <div class="panel-body" style="padding:0 0; ">
                                <table class="table" style="border:none">
                                    <tr ms-repeat-item="KJFSTag">
                                        <td ms-if="item.KJFS.size()>0" style="width:100px;border:none;border-bottom:1px solid #e7eaec; vertical-align:middle; text-align:center">{{item.TagName}}</td>
                                        <td ms-if="item.KJFS.size()>0" style="border:none;border-bottom:1px solid #e7eaec;">
                                            <div class="faq-item" ms-repeat-el="item.KJFS" style="border:none;width:auto;float:left; margin-right:10px;width:160px">
                                                <a class="pull-left" style="font-size: 16px;"></a> <a ms-attr-href="el.Link" target="_blank" class="faq-question pull-left" style="margin-left:5px; font-weight:400;  font-size:16px;">{{ComFunJS.convstr(el.title,4)}}</a>
                                                <a class=" btn btn-primary btn-xs btntool" ms-click="ViewKJFSForm(el.ID)" style="margin-left:10px;"><i class="fa fa-pencil"></i> </a>
                                                <a class="btn btn-danger btn-xs btntool" ms-click="DELKJFSForm(item,el)"><i class="fa fa-trash-o"></i></a>
                                            </div>
                                            <div style="float:left;width:auto;border:none; margin-top:10px;">
                                                <a ms-click="addKJFS(item.TagName)"><i class="fa fa-plus"></i></a>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>

                        <div id="tab-kjkh" class="tab-pane">
                            <div class="panel-body" style=" padding-left: 0;padding-right: 0;">
                                <div class="table-responsive">
                                    <table class="table  table-striped  table-hover">
                                        <thead>
                                            <tr>

                                                <th>客户名称</th>
                                                <th>类别</th>
                                                <th>客户单位</th>
                                                <th>联系电话</th>
                                                <th>操作</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr ms-repeat-el="KHGLData">
                                                <td>
                                                    <a data-toggle="tab" href="#contact-1" class="client-link">{{el.KHName}}</a>
                                                </td>
                                                <td>
                                                    {{el.KHLeiBie}}
                                                </td>
                                                <td>{{el.KHDW}}</td>

                                                <td> {{el.KHPhone}}</td>
                                                <td class="client-status">
                                                    <a class=" btn btn-white btn-xs" ms-click="ViewDT(el.ID)"><i class="fa fa-search"></i> 查看 </a>
                                                    <a class="btn btn-xs btn-default" ms-click="ViewPrint(el.ID, event)"><i class='fa fa-edit'></i> 打印快递单</a>
                                                    <a class="btn btn-info btn-xs" ms-click="SendMsg(el)"> 发送短信 </a>

                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <div id="tab-cywd" class="tab-pane">
                            <div class="panel-body">
                                <ul class="listContent">
                                    <!--repeat298559237504377969775059130042791-->
                                    <li class="lifile hvr-float-shadow" data-repeat-rendered="filechange" title="2015-08-16 17:04:41">
                                        <!--ms-if-->
                                        <i class="iconfont icon-weigouxuan"></i>
                                        <img class="fileimg" onerror="javascript: this.src = '/images/NewIndex/qywd/file.png'" itemid="50" src="/images/NewIndex/qywd/file1.png">
                                        <!--ms-class-1="copy:(PasteData>0&&PasteData[0].copycutid==item.ID)"-->
                                        <!--ms-if-->
                                        <span>  文件夹1</span>
                                    </li><!--repeat298559237504377969775059130042791-->
                                    <li class="lifile hvr-float-shadow" data-repeat-rendered="filechange" title="2015-09-05 09:25:57">
                                        <!--ms-if-->
                                        <i class="iconfont icon-weigouxuan"></i>
                                        <img class="fileimg" onerror="javascript: this.src = '/images/NewIndex/qywd/file.png'" itemid="78" src="/images/NewIndex/qywd/file1.png">
                                        <!--ms-class-1="copy:(PasteData>0&&PasteData[0].copycutid==item.ID)"-->
                                        <!--ms-if-->
                                        <span>  <!--ms-if--> 文件夹2</span>
                                    </li><!--repeat298559237504377969775059130042791:end-->
                                </ul>
                            </div>
                        </div>
                    </div>


                </div>
            </div>
            <div class="col-sm-4">
                <div class="contact-box" style="border:0;  margin-bottom:5px;padding-top: 0;">
                    <div class="col-sm-12  no-padding">
                        <div class="formtitle"><span>岗位职责</span></div>

                        <address style="margin-bottom: 0;">
                            {{UserData.Usersign}}
                        </address>
                    </div>
                    <div class="clearfix"></div>
                </div>
                <div class="contact-box" style="border:0;  margin-bottom:5px;padding-top: 0;" ms-if="JHAPData.size()>0">
                    <div class="col-sm-12  no-padding">
                        <div class="formtitle"><span>我的计划</span></div>

                        <address style="margin-bottom: 0;" ms-repeat-item="JHAPData">

                            <span>
                                {{item.RBContent|html}}
                            </span>

                            <p><a href="#" ms-click="EDITJHAP(item.ID)" style="color:cornflowerblue">填写完成情况</a></p>
                        </address>

                    </div>
                    <div class="clearfix"></div>
                </div>
                <div class="contact-box" style="border:0;  margin-bottom:5px;padding-top: 0;">
                    <div class="col-sm-12  no-padding">
                        <div class="formtitle"><span>企业公告</span></div>

                        <address style="margin-bottom: 0;">

                            <p ms-class="text-danger:$index==0" ms-repeat-item="QYGGData"><a href="javascript:void(0)" ms-click="ViewQYGG(item.ID)">【{{item.remark}}】{{item.GGTitle }}</a></p>
                        </address>
                    </div>
                    <div class="clearfix"></div>
                </div>

                <div class="contact-box" style="border:0; margin-bottom:5px;padding-top: 0;">
                    <div class="formtitle">
                        <span>自定义栏目</span><div class="pull-right social-action dropdown" style="margin-right: 0;">

                            <a class="btn btn-white btn-xs" data-toggle="dropdown" aria-expanded="false"><i class="fa fa-angle-down"></i> </a>
                            <ul class="dropdown-menu m-t-xs">
                                <li ms-repeat-item="SYData"><a>{{item.title}}<i class="iconfont  pull-right" ms-class-1="icon-weigouxuan:!item.issel" ms-class-2="icon-gouxuan:item.issel" ms-click="ChangeWidget(item)" ms-if="!item.issys"></i></a></li>

                            </ul>
                        </div>
                    </div>
                    <div ms-repeat-widget="SYData" style="margin-top:10px" ms-include="widget.code" ms-if-loop="widget.issel"></div>

                    <script type="avalon" id="gwzz">

                    </script>

                    <script type="avalon" id="wdrc">
                        <p style=" border-left: solid 3px #66c9f3;padding-left: 5px;height:20px"><strong>我的日程：</strong></p>
                        <ul class="todo-list m-t small-list ui-sortable">
                            <li ms-repeat-item="TXSXData" ms-click="ViewTXSX(item.ID)">
                                <span class="m-l-xs">{{ item.TXContent}}</span>
                            </li>
                        </ul>

                    </script>
                    <script type="avalon" id="wdgz">
                        <p style=" border-left: solid 3px #66c9f3;padding-left: 5px;height:20px">
                            <strong>我的关注：</strong>
                        </p>
                        <a class="btn  btn-sm btn-white" style="margin-right:5px" ms-repeat-item="GuanZhuList" ms-click="ViewGRZL(item.BGZUser)">{{ComFunJS.convertuser( item.BGZUser)}}&nbsp;<i class='iconfont icon-guanbi btndel' ms-click="DELGuanZhu(item,event)"></i></a>
                        <button class="btn btn-info" style=" margin-right:5px" ms-click="ADDGUANZHU()">+添加关注</button>
                    </script>
                    <script type="avalon" id="wdjh1">
                        <p> <strong>我的计划：</strong><a href="javascript:void(0)" ms-html="JHAPData.RBContent!=''?JHAPData.RBContent:'请添加本周计划'"></a></p>


                    </script>
                    <script type="avalon" id="kqqd">
                        <p style=" border-left: solid 3px #66c9f3;padding-left: 5px;height:20px">
                            <strong>考勤签到：</strong>
                        </p>
                        <address>
                            <p style="font-size:14px"><a href="javascript:void(0)">今天是{{nowday}}</a><a href="javascript:void(0)" id="timeShow"></a></p>
                        </address>
                        <button class="btn " ms-class="btn-info:QDDate.CRDate1==''" ms-click="AddCQQD(1,this)">{{QDDate.CRDate1}}签到</button>
                        <button class="btn btn-info" ms-class-1="btn-info:QDDate.CRDate2==''" ms-if="QDDate.CRDate1!=''" ms-click="AddCQQD(2,this)">{{QDDate.CRDate2}}签退</button>
                        <script language="javascript">
                            var t = null;
                            t = setTimeout(time, 1000);//开始执行
                            function time() {
                                clearTimeout(t);//清除定时器
                                dt = new Date();
                                var h = dt.getHours();
                                var m = dt.getMinutes();
                                var s = dt.getSeconds();
                                document.getElementById("timeShow").innerHTML = "：<span style='color:blue'>" + h + "</span>时<span style='color:blue'>" + m + "</span>分<span style='color:blue'>" + s + "</span>秒";
                                t = setTimeout(time, 1000); //设定定时器，循环执行
                            }
                        </script>

                    </script>
                </div>

            </div>
        </div>
    </div>
    <div class="modal fade" id="UpdateUserSignModel" role="dialog">
        <div class="modal-dialog" role="document" style="width: 500px">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">修改岗位职责</h4>
                </div>
                <div class="modal-body">
                    <div class="form-horizontal">
                        <div class="form-group">
                            <label class="col-xs-3 control-label"><span class="Required">*</span>岗位职责</label>
                            <textarea class="form-control szhl_require" style="width: 300px;" rows="4" id="userSign" ms-attr-value="UserData.Usersign" placeholder="请输入岗位职责"></textarea>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-success" id="conaddForder" ms-click="ModifyUser(this)"><i class="fa fa-spinner fa-spin" style="display: none"></i>确&nbsp;&nbsp;认</button>
                </div>
            </div>
        </div>
    </div>
    <script src="/Scripts/jquery-1.11.2.min.js"></script>
    <script src="/JqueryPlug/laypage/laypage.js"></script>
    <script src="/CSS/bootstrap3.3.5/js/bootstrap.js"></script>
    <script src="/Scripts/avalon.min.js"></script>
    <script src="/Scripts/SZHLCommon.js?jsver=5"></script>
    <script>
        var indexModel = avalon.define({
            username: ComFunJS.getnowuser(),
            $id: "indexPage",
            nowday: ComFunJS.getnowday(),
            SYData: localStorage.getItem("widgetdata") ? $.parseJSON(localStorage.getItem("widgetdata")) : [{ code: "wdrc", title: "我的日程", issel: true, issys: false }, { code: "wdgz", title: "我的关注", issel: true, issys: false }],
            ChangeWidget: function (item) {
                if (item.issel) {
                    item.issel = false;
                } else {
                    item.issel = true;
                }
                localStorage.setItem("widgetdata", JSON.stringify(indexModel.SYData.$model))
            },
            KJBtn: localStorage.getItem("widgemenutdata") ? $.parseJSON(localStorage.getItem("widgemenutdata")) : [],
            DSHData: [],//待审核列表
            QYGGData: [],//企业公告
            RWDBData: [],//任务代办
            UserData: {},//用户信息
            GuanZhuList: [],//关注用户列表
            GetDshData: function () {
                $.getJSON('/API/FTAPI.ashx?Action=GETDSHDATALIST_PAGE', { P2: 1 }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        indexModel.DSHData = resultData.Result;
                    }
                })
            },
            ViewWF: function (ID, PIID, ProName, lcType) {
                var lcStr = "";
                if (ProName == "LCSP") {
                    lcStr = "&LCTYPE=" + lcType;
                }
                parent.ComFunJS.winviewform("/ViewV3/APPBaseView/APP_ADD_WF.html?FormCode=" + ProName + "&ID=" + ID + "&PIID=" + PIID + lcStr, "审核表单", "1000", "");
            },
            GetIndexData: function () {
                $.getJSON('/API/FTAPI.ashx?Action=GETUSERINDEXDATA', function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        indexModel.QYGGData = resultData.Result;
                        indexModel.RWDBData = resultData.Result1;
                    }
                })
            },
            //公告
            ViewQYGG: function (Id) {
                parent.ComFunJS.winviewform("/View/APPBaseView/APP_QYGG_VIEW.html?ID=" + Id + "&pageType=view", "查看数据", "1000", "");
            },
            //用户信息
            GetUserData: function () {
                $.getJSON('/API/SZHLAPI.ashx?Action=GETUSERBYUSERNAME', { P1: ComFunJS.getnowuser() }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        indexModel.UserData = resultData.Result;
                        indexModel.BranchName = resultData.Result1;
                    }
                })
            },
            DELGuanZhu: function (item, event) {
                if (event) {
                    event.stopPropagation();
                }
                $.post("/API/FTAPI.ashx?ACTION=DELGUANZHUBYID", { P1: item.ID }, function (result) {
                    var jsonresult = $.parseJSON(result)
                    if ($.trim(jsonresult.ErrorMsg) == "") {
                        indexModel.GuanZhuList.remove(item);
                    }
                });
            },
            //用户信息
            GetGuanZhuList: function () {
                $.getJSON('/API/FTAPI.ashx?Action=GETGUANZHULIST', function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        indexModel.GuanZhuList = resultData.Result;
                    }
                })
            },
            NoteDataList: [], //记事本列表
            GetNOTEList: function () {
                //已添加的记事本
                $.getJSON('/API/FTAPI.ashx?Action=GETUSERNOTELIST_PAGE', { p: 1 }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        indexModel.NoteDataList = resultData.Result;
                        laypage({
                            cont: 'pageDiv', //容器。值支持id名、原生dom对象，jquery对象。
                            pages: Math.ceil(parseInt(resultData.Result1) * 1.0 / 8), //通过后台拿到的总页数
                            curr: 1, //初始化当前页
                            jump: function (e) { //触发分页后的回调
                                $.getJSON('/API/FTAPI.ashx?Action=GETUSERNOTELIST_PAGE', { p: e.curr }, function (resultData) {
                                    indexModel.CommonData = resultData.Result;
                                    e.pages = Math.ceil(parseInt(resultData.Result1) * 1.0 / 8);
                                })
                            }
                        });
                    }
                })
            },
            addNOTE: function () {
                parent.ComFunJS.winviewform("/View/APPBaseView/APP_ADD_WF.html?FormCode=NOTE", "添加数据", "1000", "");
            },
            ViewForm: function (ID) {
                parent.ComFunJS.winviewform("/View/APPBaseView/APP_ADD_WF.html?FormCode=NOTE&pageType=edit&ID=" + ID, "数据编辑", "1000", "");
            }, DELForm: function (item) {
                parent.ComFunJS.winconfirm("确认要删除”" + item.NoteTitle + "“么", function () {
                    $.post("/API/FTAPI.ashx?ACTION=DELNOTEBYID", { P1: item.ID }, function (result) {
                        var jsonresult = $.parseJSON(result)
                        if ($.trim(jsonresult.ErrorMsg) == "") {
                            indexModel.NoteDataList.remove(item);
                            parent.ComFunJS.winsuccess('删除成功');
                        }
                    });
                }, function () { })
            },
            ViewKJFSForm: function (ID) {
                parent.ComFunJS.winviewform("/View/APPBaseView/APP_ADD_WF.html?FormCode=KJFS&pageType=edit&ID=" + ID, "数据编辑", "1000", "300");
            },
            KJFSTag: [],
            GetKJFSTag: function () {
                //获取记事本分类
                $.getJSON('/API/FTAPI.ashx?Action=GETUSERKJFSINDEX', function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        indexModel.KJFSTag = resultData.Result;
                    }
                })
            }, DELKJFSForm: function (item, el) {
                parent.ComFunJS.winconfirm("确认要删除”" + el.title + "“么", function () {
                    $.post("/API/FTAPI.ashx?ACTION=DELKJFSBYID", { P1: el.ID }, function (result) {
                        var jsonresult = $.parseJSON(result)
                        if ($.trim(jsonresult.ErrorMsg) == "") {
                            item.KJFS.remove(el)
                            parent.ComFunJS.winsuccess('删除成功');
                        }
                    });
                }, function () { })

            },
            DBDataList: [],
            GetDBDataList: function () {
                $.getJSON("/API/FTAPI.ashx?Action=GETRCTXDATA_PAGE", { P1: 0, p: 1, P2: 0 }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        indexModel.DBDataList.clear();
                        indexModel.DBDataList = resultData.Result;
                        if (parseInt(resultData.Result1) > 0) {
                            laypage({
                                cont: 'pageDBDiv', //容器。值支持id名、原生dom对象，jquery对象。
                                pages: Math.ceil(parseInt(resultData.Result1) * 1.0 / 8), //通过后台拿到的总页数
                                curr: 1, //初始化当前页
                                jump: function (e) {
                                    $.getJSON('/API/FTAPI.ashx?Action=GETRCTXDATA_PAGE', { P1: 0, P2: 0, p: e.curr }, function (resultData) {
                                        indexModel.DBDataList.clear();
                                        indexModel.DBDataList = resultData.Result;
                                    })
                                }
                            });
                        }
                    }

                });
            }, deltx: function (el, event) {
                event.stopPropagation();
                parent.ComFunJS.winconfirm('你确定要删除此待办吗？', function () {
                    $.getJSON("/API/FTAPI.ashx?Action=DELRWDB", { P1: el.ID }, function (resultData) {
                        if (resultData.ErrorMsg == "") {
                            indexModel.DBDataList.remove(el);
                            parent.ComFunJS.winsuccess('删除成功');
                        }

                    });
                }, function () { })
            }, ShowFile: function (Id, event) {
                event.stopPropagation();
                $.getJSON('/API/FTAPI.ashx?Action=GETFILEINFO', { P1: Id }, function (resultData) {
                    window.open(resultData.Result2);
                })
            },
            ModityRCTX: function (Id) {
                parent.ComFunJS.winviewform("/View/APPBaseView/APP_ADD_WF.html?FormCode=RCTX&FrameName=frameRCTX&ID=" + Id, "编辑数据", "1000", "");
            },
            addPL: function (el, dom, event) {
                if (event) {
                    event.stopPropagation();
                }
                var content = $(dom).parent().parent().find(".plnr").val();
                if (content == "") {
                    parent.ComFunJS.winwarning("请输入批注内容");
                } else {
                    $.post('/API/FTAPI.ashx?Action=ADDCOMENT', { "P1": content, "MsgType": "RCTX", "MsgLYID": el.ID }, function (result) {
                        var result = $.parseJSON(result);
                        if (result.ErrorMsg == "") {
                            el.PLList.push(result.Result)
                            $(dom).parent().parent().find(".plnr").val("")
                        }
                    })
                }

            },
            completeDB: function (el, event, dom) {//修改待办状态
                event.stopPropagation();
                if ($(dom).hasClass("icon-gouxuan")) {
                    $(dom).removeClass("icon-gouxuan");
                    $(dom).addClass("icon-weigouxuan");
                }
                else {
                    $(dom).removeClass("icon-weigouxuan");
                    $(dom).addClass("icon-gouxuan");
                }
                var ISComplete = $(dom).hasClass("icon-gouxuan") ? "1" : "0";
                if (ISComplete == "1") {

                    $(dom).parent().parent().parent().css({ "background-color": "aliceblue" });
                } else {
                    $(dom).parent().parent().parent().css({ "background-color": "transparent" });
                }
                $.getJSON('/API/FTAPI.ashx?Action=COMPLETERCTX', { "P1": el.ID, "P2": ISComplete }, function (result) {
                    if (result.ErrorMsg == "") {
                        parent.ComFunJS.winsuccess("操作成功");
                    }
                })
            }, addDB: function (el) {
                var urs = '';
                if (el.RWCYR) {
                    if (el.RWCYR.indexOf(el.RWFZR) != -1) {
                        urs = el.RWCYR;
                    }
                    else {
                        urs = el.RWFZR + ',' + el.RWCYR;
                    }
                }
                else {
                    urs = el.RWFZR;
                }
                parent.ComFunJS.winviewform("/View/APPBaseView/APP_ADD_WF.html?FormCode=TXSX&ausername=" + urs + "&acode=dbsx&aid=" + el.ID, "添加提醒", "1000", "");
            }, ComGRDB: function (el, event, dom) {
                event.stopPropagation();
                if ($(dom).hasClass("icon-gouxuan")) {
                    $(dom).removeClass("icon-gouxuan");
                    $(dom).addClass("icon-weigouxuan");
                }
                else {
                    $(dom).removeClass("icon-weigouxuan");
                    $(dom).addClass("icon-gouxuan");
                }
                var ISComplete = $(dom).hasClass("icon-gouxuan") ? "1" : "0";
                if (ISComplete == "1") {

                    $(dom).parent().parent().parent().parent().css({ "background-color": "aliceblue" });
                } else {
                    $(dom).parent().parent().parent().parent().css({ "background-color": "transparent" });
                }
                $.getJSON('/API/FTAPI.ashx?Action=COMGRRCTX', { "P1": el.ID, P2: ISComplete }, function (result) {
                    if (result.ErrorMsg == "") {
                        parent.ComFunJS.winsuccess("操作成功");
                    }
                })
            },
            addZRW: function (ID) {
                parent.ComFunJS.winviewform("/View/APPBaseView/APP_ADD_WF.html?FormCode=RCTX&FrameName=frameRCTX&TopID=" + ID, "添加数据", "1000", "");
            },
            viewZRW: function (ID) {
                parent.ComFunJS.winviewform("/ViewV3/APPBaseView/APP_ZRW.html?ID=" + ID + "&pageType=view&r=" + Math.random(), "子任务", "1000", "");
            },
            //键盘提交事件
            jptj: function (el, dom, event) {
                if (event.ctrlKey && (event.keyCode == 13 || event.keyCode == 10)) {
                    indexModel.addPL(el, dom);

                }
            }, ADDGUANZHU: function () {
                parent.ComFunJS.winbtnwin("/View/Base/UserSelect.html", "选择人员", 900, 540, {}, function (layero, index) {
                    var frameid = $("iframe", $(layero)).attr('id');
                    var people = parent.window.frames[frameid].getqiandaopeople();
                    if (people.userid) {
                        $.post('/API/FTAPI.ashx?Action=ADDGUANZHULIST', { "P1": people.userid }, function (result) {
                            var result = $.parseJSON(result);
                            if (result.ErrorMsg == "") {
                                indexModel.GetGuanZhuList();
                            } else {
                                alert(result.ErrorMsg);
                            }
                            parent.layer.close(index)
                        })
                    } else {

                        parent.layer.close(index)
                    }
                })
            },
            ViewGRZL: function (userName) {
                parent.ComFunJS.winviewform("/ViewV3/APPBaseView/APP_GRZL.html?UserName=" + userName, "添加数据", "1000", "");
            },
            //修改用户
            ModifyUser: function (dom) {
                var retmsg = "";
                if ($("#UpdateUserSignModel .szhl_require")) {
                    $("#UpdateUserSignModel .szhl_require").each(function () {
                        if ($(this).val() == "") {
                            retmsg = $(this).parent().find("label").text() + "不能为空";
                        }
                    })
                }
                if (retmsg !== "") {
                    layer.tips(retmsg, dom);
                    return;
                }

                indexModel.UserData.Usersign = $("#userSign").val();
                var modelValue = JSON.stringify(indexModel.UserData.$model);
                $.post("/API/SZHLAPI.ashx?Action=ADDUSER", { P1: modelValue }, function (result) {
                    var jsonresult = $.parseJSON(result)
                    if ($.trim(jsonresult.ErrorMsg) != "") {
                        parent.ComFunJS.winwarning(jsonresult.ErrorMsg);
                    } else {
                        parent.ComFunJS.winsuccess("操作成功");
                        $('#UpdateUserSignModel').modal('hide');
                    }
                });
            },
            KHGLData: [],
            GetKHGData: function () {
                $.getJSON('/API/FTAPI.ashx?Action=GETCYKH', { p: 1 }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        indexModel.KHGLData = resultData.Result;
                    }
                })
            },
            ViewDT: function (id) {
                parent.ComFunJS.winviewform("/View/APPBaseView/APP_KHGL_LXJL.html?FormCode=KHGL&ID=" + id, "客户联系记录", "1000", "");
            },
            ViewPrint: function (ID, event) {
                if (event) {
                    event.stopPropagation();
                }
                parent.ComFunJS.winold("/View/APPBaseView/KHGL_Print.html?ID=" + ID);
            },
            JHAPData: {}
            , GetJHAP: function () {
                $.getJSON('/API/FTAPI.ashx?Action=GETJHAPWEEK', function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        indexModel.JHAPData = resultData.Result;
                    }
                })
            },
            AddJHAP: function () {
                var viewUrl = "/View/APPBaseView/APP_ADD_WF.html?FormCode=JHAP";
                if (indexModel.JHAPData.RBContent != "") {
                    viewUrl += "&ID=" + indexModel.JHAPData.ID;
                }
                parent.ComFunJS.winviewform(viewUrl, "添加数据", "1000", "");
            },
            AddCQQD: function (Status, dom) {
                if ((indexModel.QDDate.CRDate1 != "" && Status == 1) || (indexModel.QDDate.CRDate2 != "" && Status == 2)) {
                    return;
                }
                $.post("/API/FTAPI.ashx?Action=ADDCQQD", { P1: Status }, function (result) {
                    var jsonresult = $.parseJSON(result)
                    if ($.trim(jsonresult.ErrorMsg) != "") {
                        parent.ComFunJS.winwarning(jsonresult.ErrorMsg);
                    } else {
                        if (Status == 1) {
                            indexModel.QDDate.CRDate1 = jsonresult.Result;
                        } else {
                            indexModel.QDDate.CRDate2 = jsonresult.Result;
                        }

                        $(dom).html(result.CRDate);
                    }
                });
            }
            ,
            QDDate: {},
            GetCQQD: function () {
                $.getJSON('/API/FTAPI.ashx?Action=GETCQQDSTATUS', function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        indexModel.QDDate = resultData.Result;
                    }
                })
            },
            SendMsg: function (item)//发送短信
            {
                parent.ComFunJS.winviewform("/View/APPBaseView/APP_ADD_WF.html?FormCode=DXGL&phone=" + item.KHPhone, "添加数据", "1000", "");
            },
            TXSXData: [],
            GetTXSXData: function () {
                $.getJSON('/API/FTAPI.ashx?Action=GETTXSX_INDEX', function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        indexModel.TXSXData = resultData.Result;
                    }
                })
            }
            , AddTXSX: function () {
                parent.ComFunJS.winviewform("/View/APPBaseView/APP_ADD_WF.html?FormCode=TXSX&r=" + Math.random(), "添加数据", "1000", "");
            }, ViewTXSX: function (ID) {
                parent.ComFunJS.winviewform("/View/APPBaseView/APP_ADD_WF.html?FormCode=TXSX&pageType=view&ID=" + ID + "&r=" + Math.random(), "添加数据", "1000", "");
            }, addKJFS: function (TagName) {
                parent.ComFunJS.winviewform("/View/APPBaseView/APP_ADD_WF.html?FormCode=KJFS&tagName=" + escape(TagName), "添加数据", "1000", "500");
            },
            EDITJHAP: function (ID) {
                parent.ComFunJS.winviewform("/View/APPBaseView/APP_ADD_WF.html?FormCode=JHAP&ID=" + ID, "修改数据", "1000", "");
            },
            OpenCreateForm: function (ProName) {
                parent.ComFunJS.winviewform("/View/APPBaseView/APP_ADD_WF.html?FormCode=" + ProName, "添加数据", "1000", "");
            }
        })
        avalon.ready(function () {
            indexModel.GetDshData();
            indexModel.GetIndexData();
            indexModel.GetUserData();
            indexModel.GetGuanZhuList();
            indexModel.GetNOTEList();
            indexModel.GetDBDataList();
            indexModel.GetKHGData();
            indexModel.GetJHAP();
            indexModel.GetCQQD();
            indexModel.GetTXSXData();
            indexModel.GetKJFSTag();
        })
        function rwzt(str) {
            if (str == "0") {
                return '<label class="label label-danger" style="margin-right:10px">正在进行</label>';
            }
            else if (str == "1") {
                return '<label class="label label-default" style="margin-right:10px">已结束</label>';
            }
        }
    </script>
</body>

</html>